package geppetto.phraseScorer;

import geppetto.cat.models.AbstractModel;

public class BothDirectionsDirectionalModelPosterior extends AbstractPhraseScorer{

	AbstractModel _forward;
	AbstractModel _backward;
	
	
	public BothDirectionsDirectionalModelPosterior(AbstractModel forward,AbstractModel backward){
		_forward = forward;
		_backward = backward;
	}
	
//	public double getNullPhraseScore(int sentenceNumber, byte sentenceSource, int[] foreingSentence, int[] sourceSentence, int foreignStartPos, int foreignEndPos) {
//		return _forward.getNullPhrasePosterior(sentenceNumber, sentenceSource, foreingSentence, sourceSentence, foreignStartPos, foreignEndPos);
//	}

	
	public double getPhraseScore(int sentenceNumber, byte sentenceSource, int[] foreingSentence, int[] sourceSentence, int sourceStartPos, int sourceEndPos, int foreignStartPos, int foreignEndPos) {
		double prob = (_forward.getPhrasePosterior(sentenceNumber, sentenceSource, foreingSentence, sourceSentence, sourceStartPos, sourceEndPos, foreignStartPos, foreignEndPos) +
				_backward.getPhrasePosterior(sentenceNumber, sentenceSource,  sourceSentence,foreingSentence, foreignStartPos, foreignEndPos, sourceStartPos, sourceEndPos))/2;	
		return prob;
	}

}
